#ifndef								__CONNECTIONMANAGER_H__
	#define							__CONNECTIONMANAGER_H__

	#include						<boost/asio.hpp>
	#include						<map>
	#include						"IAsyncTcpSocket.h"

class								ConnectionManager
{
public:
	ConnectionManager(Processor &, boost::asio::io_service &io_service, unsigned short port);
	~ConnectionManager();

private:
	boost::asio::ip::tcp::acceptor	_acceptor;
	std::map<unsigned int, IAsyncTcpSocket*>		_client;
	Processor						&_proc;
	unsigned short					_current_id;

public:
	void							start();
	void							SendOrderToId(IOrder*, unsigned int);
	std::string						getIp(unsigned int);

private:
	void							_start_accept();
	void							_handle_accept(IAsyncTcpSocket *, const boost::system::error_code &);

};

#endif								// ! __CONNECTIONMANAGER_H__
